package com.example.concurrent.BlockingDeque;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

/**
 * Created by Administrator on 2017/2/10 0010.
 */
public class BlockingDequeDemo {
    public static void main(String[] args) {

        try {

            BlockingDeque<String> deque = new LinkedBlockingDeque<String>();
            deque.addFirst("1");
            deque.addLast("2");

            String two = deque.takeLast();
            String one = deque.takeFirst();

            System.out.println(one);
            System.out.println(two);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
